package top.codedance.iotp.registy.net.configration;

import top.codedance.iotp.registy.net.handle.Controller;
import top.codedance.iotp.registy.net.handle.action.*;

import java.util.HashMap;
import java.util.Map;

public class HttpRouteConfig {
    private static final String CONTENT_PATH = "/rest/api";

    public static Map<String, Controller> getConfig(){
        HashMap<String, Controller> routeConfig = new HashMap<>();
        /**
         * 注册中心信息
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/information", new InformationController());

        /**
         * 健康检查
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/healthy", new HealthyController());

        /**
         * 注册服务端
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/server/register", new RegistyServerController());

        /**
         * 注册客户端
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/client/register", new RegistyClientController());

        /**
         * 取消注册客户端
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/client/unregister", new UnregistyClientController());

        /**
         * 根据设备ID获取服务器元信息
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/serverMeta", new ServerMetaController());

        /**
         * 注册中心同步数据
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/registy/sync", new SyncDataController());

        /**
         * 注册中心选举
         * request:
         *
         *
         *  response:
         *
         */
        routeConfig.put(CONTENT_PATH + "/election", new ElectionController());

        /**
         * 选举成功后，主节点向其它节点下发主权
         */
        routeConfig.put(CONTENT_PATH + "/victory", new VictoryController());

        /**
         * 查询服务列表
         */
        routeConfig.put(CONTENT_PATH + "/query/server/list", new QueryServerListController());

        return routeConfig;
    }
}
